package com.yanqu.road.server.cmd.activity.peakseacraft;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.PeakSeacraftProto;
import com.yanqu.road.pb.union.UnionProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.peakseacraft.PeakSeacraftMgr;
import com.yanqu.road.server.protocol.CrossProtocol;

import java.util.List;

/**
 * @Description
 */
@Cmd(code = CrossProtocol.C_PEAK_SEACRAFT_SYN_UNION_MEMBER_CHANGE, desc = "海上争霸 南海丝路 同步联盟成员")
public class CrossPeakSeacraftSynUnionMemberChangeCmd extends CrossUnionCommand {

     int activityId;
    int type;
    String unionId;
    UnionProto.UnionBaseTempMsg unionBaseTempMsg;
    List<PeakSeacraftProto.PeakSeacraftMemberPositionTemp> positionList;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        PeakSeacraftProto.PeakSeacraftSynUnionMemberGameToCrossMsg reqMsg = PeakSeacraftProto.PeakSeacraftSynUnionMemberGameToCrossMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        type = reqMsg.getType();
        unionId = reqMsg.getUnionId();
        unionBaseTempMsg = reqMsg.getUnionInfo();
        positionList = reqMsg.getMemberPositionList();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        PeakSeacraftMgr.changeUnion(type, activityId, positionList, unionId, unionBaseTempMsg);

    }

    @Override
    public void sendData() {

    }
}
